package zcj.stu.test2;

import android.content.res.ColorStateList;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;

public class EX02Activity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_ex02);
        Button login =(Button) findViewById(R.id.button);
        EditText phone =(EditText) findViewById(R.id.editTextTextPhone);
        login.setOnClickListener((b)->{
             if(phone.length()!=11){
                 login.setText("登录");
                 login.setTextColor(990033);
                 login.setEnabled(false);
                 return;
             }
             login.setText("登录成功");
        });

    }
}